General improvements, refactoring and the 'ezd' command