Setting up functions and framework