Refractored

Lacks comments and convert do BCD