Console and threads

Add commands for console
Organized server processed in single thread
Add terminate threads where stop command