Tweaked code for Android SDK