Small rewrites (to be continued)
Continued with bugfixing