Refactor parse_key method in params class.