refactored code. added fixes. Working untill group session