Refactor getMoves