Added test mode and sample output