Clean the code and fix a bug with the fog