Merge & fixes

This is a merge of many PR + fixes + tests for anyone to test it.

I will merge it into master this week if no problem found.