Reordered methods for clean code and added some documentation
Added some more code documentation