Minor bugfixes and cleanup, start of preferences system
Allow changing preferences, fix coding standards