updated main.cpp to fix a lot of memory leaks
added signals.script