implemented image publishing and cleaned up the implementation