moving many logic to fragment