Solved coding problem