Remove redundant code and deprecated calls