Small tweaks and addition of unit tests
Version 0.5