Manually applied changes from ramiro