Added minimal functionality to make suitable for embedding in other pages