Tidied python plugins

Use private naming convention
Move local callback functions to top