Update code style and $mode default value following pull request feedback