js goes back a step, trying to get this function to return something useable