Refactoring open line functions