refactor ready for deployment