completed extraction of reusable code