Finished isLegal functions