removed code repetition for positiion