added option to run as daemon