Improvements to get code working on android