Adding working script for writing variables