Update for assignment

Removed setwd, cleaned up repetitive code