Helpers for line handling