Fixes and improvements for the last few commits