improvement to gallery convert script - not finished