cleaned up gallery js