Ported all functions and optimized the whole tree

Optimized lots of cycles with adding manual assembly parts.
Added missing ports