Review Please.
Removed duplicates, consolidated code, applied git style formatting