Refactored dependencies a bit. Added more tests