Introduce FunctionBlock tree and refactor to share more code
More explicit super calls and added comments