Refactor moveSelect code