Revert "declared helper functions"

This reverts commit afe30d98a6ad90de608f6bc040e64b064de001e2.
Revert "Revert "declared helper functions""

This reverts commit e8074478b280cdab89fe1c549c6927d8fae37581.