Main logic finished