added comment,
cleaned some method to handle exeption.