Changed block length to be defined by a constant.
Also cleaned up code a bit.