adding flash detection, model will run on 'enter', bug fixes