Refactoring, add more tests for generated methods