moved deque bisect-insertion to a utility function; added bisect-based deque item re-sorting function - closes #124