Performance improvements to doLineClear
finished refactoring doLineClear