Added bit manipulation, with test