utils.c added. Better errors logging.