this is like a bad version of beagle-lib