still refactoring tutorial code