Very flawed but produces the answer