Utilize histogram's direct api

Also eliminate raw type declarations when possible