Cleaned up code a bit (using eastwood, kibit, bikeshed)