merged Alex' enhancements