sell function works