cleanup of result logic