cleanup code, replace deprecated method