changedged the function around