Cleaned up. Implemented exercise 3 (Prim's algorithm)