Replace bash scripts with function, add model for results