refactoring, cast