Various minor code fixes

File renaming that didn't reach the solution file, code style change and a minor code improvement.
Also updated the format style script since it left trailing cr endings on non-empty final lines. This change puts a dependency on perl but I guess that's ok. Please check if the script works on a native linux.