some code rearranging and debugging, experiments for new polymorphism inference