Debugged version, mean changed to solve