Refactor for reuse
Add comments