added functionality for endsession btn and end of game behavior