logic implemented fully