Updated main, added unit tests. Needs coverage improvement.