extract fog code to parts/