Android performance optimizations, fixes #61