Changed stock function. The last one didn't make sense.