Refactoring asSomethings into as[T]