Completed all the code! (Untested)