Debugged trade functions