Added complete support for multiple terminals