converted to android library for convenience