some refactoring, trying to get this project working again