Added the non-flex version by @MarkReale