added comments, organized structure