Merge "Refactor with interface pattern, and throw exception for unsupported formats" into main