Turn map and sort imports into a separate helper method