added bit manip function