Added brief comments and grouped similar methods together.