issue #1582 and some other improvements in tthe coding style
?> at the end
Merge pull request #1588 from conejoninja/1582

1582