Few Changes for better error handling