made some locally used functions static