removed unncessary ifs in divide (scala handles these for us)