Fix #663

changes made apart from point number 3 - need discuss