widget session : refactoring code