doing some function programming
big rework of many functions :)