corrected thumbnail resizing
code cleanup
reworked thumbnailing
added more testing
Added more functions