Rearranged methods and added comments.