Added tests, minor changes in code making it Linux compatible