Some fixes for Jesper.
Merge pull request #1 from d-Pixie/master

I did some refactoring...