Added comments explaining everything