Added debugging switch and renamed init() to prevent namespace collision when the script is sourced from something else (eg .bashrc)