Pre and post order functions implemented