Added string handling and most error handling