Code debugged and working