migrate to inheritance instead of copy-paste