Updated tests and improved interface. Added apikey support