Minor changes
Minor refactorings and type inference changes