rewrite decorator class to decorator function