A few tweeks

Compile time definitions and added pass by reference where appropriate.