changed the function, now it does what it says it should do