Added comments in the code for most methods