refactor and bootstrapped code