A small correction and refactor