Bash functions, some design changes