solution
clean up
simplied version