finished sell function