removed all unnecessary FOR loops