$mode -> $_mode (to avoid overwriting)