updated so that it will work packaged as a jar