rewrite not to use traits