Code cleanup

A few bits making the code simpler and more modern.