added recursive functions