divide function complete