Refactored method names and added better logging in case of type mismatch.