updated AccountHandler, added code to ensure datatypes returned by the
database are correct and general tidy up