Restored code and remade it as a fragment