move basic workflow into main script