imported changes from Burocrat