small refactoring and adding feature handling