Removed assigned but never used total_len variable