modified encoder to contain two constructors, one is typical encoder and the other is blockwise encoder