moved some python functions into modules