Refactored makeMove