Adding Type Inference and massive refactorings