Combined both examples into one actual example function