Code cleanup: Round 1

* Cleanup code to be more concise
* Comment out variables only initialized or set for debugging purposes
* Removed dead code

This helps for readability in the codebase and makes bullet less bug prone.

The resulting code has been tested on GCC and Clang and the libs and demos work as expected.