Mid refactor