Replicated code from Turtle project