Pseudocode for Actual working program