put in more error handling and checked grammar