refactored to enable easy overrides
update tests