modifying code to work in nohup, removing compiler warnings