replace code from tutorial