some refactorization, changed func_get_args for named parameters