Debugged version.