Refactor code, get meta data with a unified function.