code refactoring private fields and some methods