Refactored some tests and added/changed a few comments.