imagex.c: Cleanups, adding some comments