Major refactoring and cleanup. Made organigrid plugin.