refactored and included some dependencies