Edited main for compatibility.