Check for empty lines and return the correct object