fixed based on Conor's suggestions