Updated to newer methods to remove deprecated warnings at runtime