Changed script structure. Now each function has it's own file and corresponding test file.