new master with some fixes