Add a function entry point to start script
Remove unused code
Fix logging errors