changed api and fixed start/stop thread creation