Made a start at exception/ error handling.