added comments and restructured sell
added comments and restructured sell
fixed binary search to work properly
fixed binary seach and changed input methods