Reworked code

Removed deprecated code, fixed newline errors