added serialization of state
done initial work for adding images to units