improved python syntax and now app works again