Refactoring. First demo version