Most of Program works

Works for examples 1 and 2