Moved functions to common.sh