Pull latest changes to stay in sync

I'll try to comment changes to the best of my understanding