Some modernization and cleanup