Many bugfixes, some alterations
Added output sanitisation