added bit manipulation