seperated python functions from view