revise code for position