Comments and Errorhandling added