Added unit tests, remove demo code