removed some extraneous if blocks