No more sqrt, added minor changes to main.