removed for-in loops; cleaned up syntax