simplify and reformat typing rules
remove unused code