removed extra loop