Added sourcing of functions. Commented out sections that aren't working yet.