Added complete logic to problem 1, initial push of problem 2