Added code to check if code completion was sucessfully done