added submodules and fixed some bugs