Removing double printfs