add comment and try-except block