Code Cleanup

Made some small improvements such as adding const correctness where
appropriate.