Merged with Mateis commits