Moved setup code to separate module.

This resolves a circular import issue.