finished parts 1-4 with MUCH less code