removed unneeded dependencies & extracted some functions