added pseudo code and functionality to form4