Made the partition bit width configurable and refactored id assignment to make it more explicit. NOT YET TESTED.