Changed the entire program to almost work