refactored main wrapper to put pandaseq inside a function