cleaned up tutorial code