write steps and main. supports ranges for outputs