new version with tests and github compatible