refactored and implemented gamestatus function