Minor changes. Error handling.