Address review comments and add more tests