Combined user allowed movement function with movement code