Added preconditions, postconditions, and documentation