fix up dependencies and ordering