Me and my best friend started dating, it was on and off for about 8 months. We then broke up and decided to have no contact for a month. After that month we started talking almost everyday again but then he started to need distance and about a month after that he met a new girl which led to him wanting distance because to quote him "if we keep being close friends we will end up back together and will never be able to move on". I gave him space and stopped contacting him. We still spoke occasionally, mostly when he helped me with programming (which I'm learning and he works with). A couple of weeks ago he started messaging me about things that had nothing to do about programming and this week he has contacted me almost everyday just randomly late at night. Most of the time about programming but he seems eager to show me what he is working on and he also started talking about how he is stressed (Which he did a lot when we dated to make me calm him down). He hasn't even once mentioned the girl to me even though I think they are still together. I feel like he's keeping her secret from me because he knows it hurts me but is regular contact recently really confuses me and I don't get why he is suddenly so talkative with me. I feel like he's sending out the wrong message to me because he was the one that needed space and now suddenly he isn't giving me any space. Plus he has a girlfriend but is messaging me late at night, doesn't seem fair to the girl. and if he wants to be friends, at least tell me he is still together with her. Shouldn't he be the one telling me so I dont have to hear it from everyone else?

what do you guys think is going on? How can I deal with this the best way?