removed duplicate code, fixed method object reference