small performance improvement and compatbility with .net 2.0

* removed linq usage for compatibility with .net framework 2.0
* removed forgotten debug code
* improved code readability