Part 3 & 4: fix problem with sqrt function