Introduce 'IOCompositor' to clean up compositor code.

This change compositor code to objective, short scope, reducing closure functions. It will increase maintainability.

Related: #1351.