common.sh script improvement + new control functions
Fixes #1