tutorial refactoring, action bug fixes