refactor, add doc string