removed use of 'function' for POSIX compliance