Move position logic into position.js