restructuring code
adding tests and changing to hex