removed duplication in recursive methods