debugged and working