Make fog code in map stage more readable