Internalize dependencies, shuffle things around a bit