First attempt at handling errors