clean-ups and unit tests