Updated code according to specifications.