Minor changes related to JML

Revised JML output formatting: removed unnecessary whitespace and blank lines inside JML comments.

Refactored some duplicate code.