Added implementation for legal moves