Tidy up code and version 1.0