Added dependencies and tests, improved overall code