some code refactoring, fixed bug in code generation concerning the method names