fixed use of bit operators; clean up source code