Added stolen divide function