replaced regex based parsing code by bit operations