Made it a little more neat, almost functions correctly. Forgot to use git..