trimmed down double logic