naming refactoring, some bug fixes