I didn't do an exact comparison but this code looks very similar to gallery...