Removed useless code.
Reformated code and comments a bit.
Fixed line clear bug, caused by javascript's amazing sorting.