added thumbnailing and overwrite functionality