Debugged and fixed