builder refactor and tests