everything is working, ugly as sh** though. let's clean up