improve function and define lazy evalution.