Cleanup

Some more general cleanup; just trying to make the code a little bit more readable as well.