Strip unnded whitespaces, fixing line endings to UNIX style, catalog SQL optimisations. [obsoletes #544]

Ignore warning about requiring of #544 if any. I missed, that github add all non-pulled commits to pull-request ;)