Minor bug fixes. Can now be ran with crontab