Adds all this logic in thar.