Use function and local variables for easier code sharing (TBD)