Refactor algorithms to make use of Uint32, Uint16 and Uint8 classes

fixes #3