Made code compatible with Java 6 (Dalvik)