Code refactoring to take advantage of the fragments hierarchy