Refactoring divider. Also fixes issue #5