heavy refactoring still not happy with packageing