Refactoring. Works on Android.