Fixing syntax errors for sliding method