refactoring, added some parts