More work on bit masks (category, contact, collision).

Clean up some part of the code.