major refactoring, added image2 command