clean up line state logic