refactor procedures