Moved some code from activity to the fragment that manages the data