Added some comments and renamed methods more logically