added comments for code functions