Little refactoring and implementation