referenced lecture code