Not working implementation of div/mod