cleaning up, reorder methods, adding comments