added paremeters for multi-gpu support, slightly refined code