added more functions, inserted logic to determine direction of piece with king