Few error checks
pthread code sketch complete