use binary and instead of modulo