added code from tutorial source, testing now