Now state stores the function data (not global anymore). Changed read_file, createFrame and main test.