Speed up 'stock check' and 'stock history' functions
Speed up ui.tableformatter

Hopefully O(n^2) -> O(n) ...