Some refactoring. No new functionallity