changed shebang and adjusted script header
simplified using function pointers