improved readability in switch statements, other minor cleanups