first refactoring of working draft