moved some more blocks of code out to separate twigs