ENH: Cleaner code, fix warning