Changed function positions; deleted old function