Added dependencies, and fixed some bugs.