Refactor: merge get & set into a single common routine