refactorings and added Type