Added a subroutine called BITMASK

See subroutine comments to use function to generate bitmasks