Refactor interface casting