Refine structure of the code (TBD)