Move imports to the top of the file
Use consistent naming throughout the file
Add tests for auto_restart