Puked a bit on my old code

Clean-up, creating a few testcases (should have done this _before_
creating the functions, I know. I just hacked this project togheter..)