Sort of working before refactor