Address CR comments and add a test