moved operations outside of parameter section of functions and assigned splice results to variables