changed all old style casts to new style c++ casts
Removed some extraneous functions and some minor cleanup