refactoring and cleaning up reversal learning