still untested
change $ -> .
Changed . back to $
slightly better comments