Put all dependencies in one function, added functionality, fixed indents