Fixed recursion and added autoboxing for ints