dont use recursion as it freaks out ruby