Changing function name,also i have to mention that solution has written in ruby language