Switched to using clock() vs time() to get system time (should correct NaN errors) and also fixed some warning problems