cleaned up fog code