Removed useless math parts, added unit tests and example.