remove some recursion and silly complexity