small refactorings and implement enhancement #4