code cleanup
fix argument processing