Updated for better Pythonista compatibility