Added struct with reference count for issue #554