first publish - code done in 2013 with minor changes