remove unnecessary cast and other lines