refactor and make fragment more like fragment