Adjusted code to PSR standards
Documented most functions