My question involves criminal law for the state of: Alaska

A few weeks ago I was riding as a passenger in a friends car when he was stopped for "swerving." He was not drinking and at the time the road we were on was unplowed with about 8 inches of snow (which is why it may have appeared he was swerving).

Anyways I had just under an OZ of marijuana on me the officers come up to us and they make us roll all the windows down so "they can see us" before the driver even hands over the registration/license. The cops start going crazy like they were messing with us saying how much they love weed except that it's ILLEGAL (no joke), and how they can smell it. After which they come over to me and say give us the weed we know you have it!

After watching their show they kept putting on for about 5 minutes I take it from my pocket and give it to them and then they have me step out. They start asking questions about who's the grower etc. give us the big fish and how much did you pay for it, (I remember saying 250 or something) they take my phone and start going through it with me. We're standing there about 5 minutes (I didn't give them anything) and then they handcuff me and read me my rights, put me in the back of the car.

My question here, is all of the questioning and stuff they did with me while I was outside the car going to have any effect on my case based on the fact I was clearly detained and did not feel free to go when I wasn't read any rights (there was 3 cops by that time surrounding me)? I realize I voluntarily gave them the weed so this may be moot and enough to convict but then again they seemed to know it was me the whole time yet they didn't take me out and search me or anything.

Second question, would there be any argument we were illegally pulled over based on the snow? Again, he wasn't swerving around like he was drunk or reckless, he just tried keeping the wheels straight so we wouldn't go in the ditch.

I've got arraignment coming up, i'm considering pleading no contest but I'd hate to have that on my record the rest of my life as we don't have any deferral and simple possession is still a B Misdemeanor up here. They can SIS the sentence but it still shows up on a record with the SIS notation next to it. I can't afford a lawyer so I have to wait for arraignment to be appointed one and unless some miracle happens (like a disorderly conduct plea bargain at arraignment) i'm going to have the defender look at everything but i'd like to be informed myself. Thanks!