remove non-pure functions
beginning of lib3