Refactored to using piece flags instead of piece object, need to test to see which version is faster