updated slider; cleaned up loop code