Merged work from lappy tutorials