Improved the division function and wrote a test