a implementation of some function used by the kramer