refactored param parsing into two methods