major refactoring - making design more OO