migrate to using class, transfering scope