major refactoring, making use of a few julia 0.2 features, in preparation for adding GUI elements