debugged and added parameters