changed to more functional style of splitting buys and sells