added comments and new condition
corrected querry for open games
refactored some code / corrected listeners