a for loop may solve the code leagth