Added comments and reformated some methods