initial version

earlier version wrong code copied