Improve stream building and functions

- Get rid of the ugly BY() macro.
- Make rate work again