wrote comments for all functions