Almost full functionality restored. Code is less shitty than before.