simplified fog code, fixed text align bug