wip - major refactoring - client core