Scalar extract

I've implemented an alternative that I feel is a little cleaner. Tell me what you think.