Refactor to include bundling (tests failing)