some simplifications and code pretty printing