Some type fixes and const correctness.
Merge pull request #27 from Ventero/const

Some type fixes and const correctness.