finished part 2, although its still buggy