Make slide function more readable