Transfer things into function (tested)