implement new gym logic