updated but has some issues/stack too deep