Added some declarations and renamed an old function.