refactoring some issues