refactor to use dependencies