refactor code, added services and fragments