refactor code to use bluesprint