Moving types and functions up to top-level