some error handling is been added