Updated loo p and function file