Refactoring and more types.

Refactored the code and made the library capable of handling more types
(longs, shorts, floats, and doubles).