Pseudocode for 1c implemented. Need to debug and test still.