Reviewed setType func now it works 100%