rewrite to make it more similar to  sqrt