Fixed refactor errors