refactored trading system