Fixes #18 and some rendering optimizations for iOS.