adding first version of function