Added buildBitmask function, needs Implementation