code tweaks and cleanups.
code optimization and cleanups.
many refactorings, optimizations and cleanups around the Bezier curves code.