Refactored line burning logic. Fixed a memory leak.