refactor for best practices