fixed Luke's code