Working on overhauling error handling