improve comments & error handling