awful code, complete hack just committing for backup
will require major refactoring / clean up