Rewrote Image class using the new BaseAPI and fixed bugs.