Remove unneeded if and clean up imports