Fussy baby

Lastnight my girl would not go to bed spent five hours trying she was screaming hubby thought she was constapaded but she pooped and peed I fed her she would eat for a bit pull away and cry again if I help her or tried to burp her she would stop for a little bit then start again finally at 1:10 am she started feeding and stopped pulling away and finally fell asleep and slept good all night. What can it be ?