This reverts commit 8da0e95c.
Restrict maximun size of image. #638
Also restructure files containing interfaces.