Refactor decision of contour levels into its own function