Implemented segment sorting. Code cleaned up. TODO: improve sorting. Build global function to deliver tournament function to various parts of the app in a common way (segments sorted, chips sorted, etc...)