implemented signal logic
added stackless mode