Code cleanup

More work on #97.

If its clean it yours @odininon