Moved duplicate code to utils.lisp
Some cleaning.