finished code with problem in trickleDown