Added epoch time function and updated error logging