Modifications for Android compatibility