adding in kastman changes from fork