Added new parts coding that is slightly faster and uses less memory.

- Also some experimental changes in bedges.py.