Changed source to functional version