tried to make maxPosition dynamic but it won't update