Added prototype for using dynamic variables in Spark. Needs more testing, tidy-up, and documentation.