Working on better error logging