Move flash functionality to separate class method