Merged the remaining changes, updated tests #1 #2