split up existing type-validation method to separate concerns further, fixed some cs issues