Added function comments, cleaned up other comments