Adjusts name extraction function and corrects few bugs