amended various functions