Setting up functions and trying to recreate results