Added comments explaining code