front logic for code instant win finally working