Add explicit dependencies and clean up code base

This is a work in progress pull request that uses an explicit dependency system instead of the implicit dependencies.