refactor for reuse in future