Small misc code enhancements