Made so can be started as cron - Cleaned up slightly