Code cleanup and minor aesthetic changes