added code to Android as well