added more coding to my Javasript/story including a function.