removed redundancies, cleaned up ugly code, removed commented out sections