Improvements from @aidraj master