Many changes

*.ini file was added. All global variables removed. Functions split into
files. Proper delay added.