square roots and some tweaks