Some code cleanup

The last commit already fixed #8, now just some overall cleanup.