Modifying to be the same library code. May have to find a better way to manage this...