Working and tested script for Gaiam (version 1.0.3)