continued merge. merge complete but still contains many bugs which need to be fixed. do not use this version.