couldn't stand the statics, so forced a workaround without major
editing. Will probably optimize code soon because I can't believe I
wrote such ugly code. Plus all the indentations are screwed up