fixed thumbnailing and removed debug code