Added all the code. (incomplete)