pseudo codes for various functionalities