Update portfolios functions and design the code.