Separate declarations from actions
Remove unused sexyfox_running function
Dont repeat yourself PLOCK=profile lockfile
Separate program logic from function declarations
Use the previous profile if an improper shutdown is detected
Add description of profile recovery operation on improper shutdown