refactors ftw. it now works properly, need config stuff