updated version, without apache velocity and possibility for two output steps