Cleaned up the loop