So I found out more about the gyms.
1) there is a time limit now.
2) you must keep giving your pokemon berries for them to stay in the gym. Otherwise the are knock out. The longer your in a gym the more money you get.
3) if you don't give your pokemon a berry in time your pokemon well return with the money. Also you do keep the gym badge.
4) you can get items from the gym as well. As long as your on the same team as that gym.
Pokemon Trainers Tag~