refactored framework a bit