Bunch of small fixes and enhancements