Some perfomance improvements