Added cap based on bitwise bits of javascript.