Refactoring linediagram