primrec: cleaned up