Can lines be negative? If not then why check for > 0? I see this is a refactor so feel free to ignore.