Use sementically correct types
Currently, the variable types are good enough to get the code working, but not always "the best ones" in term of semantics. This can be improved while going through the refactoring.
What is the expected correct behavior?
Variable types are chosen according to the variable semantic.