This should be moved to a separate library.