I moved all the block related methods to a plugin file. This also significantly reduce code verbosity.