Fix various bugs. Works on Android and iOS
Adding timer, cleaning up iOS code