Improved comment, layout and type declarations

Moved (>>>) reverse composition to end of the line to improve
readability. Added comments. Added missing type declarations