working version, thanks to leah hanson https://groups.google.com/forum/#!topic/julia-users/aRo-eZWATOw