Completed main logic for task 4

Still need to complete some methods and test that this actually works.