moved core functions from the msa notebook
updated so important code is printed from iab, rather than implemented directly