add in lots of gelato code, currently doesn't compile though