code corrected after errors from git merging