Initial port from php script.