Tidied version for class

Needs more comments