add some error checking to linux daemon, break out some modules