Refactoring of data and event lsisteners to enable use of fragments