Fixed errors. Finished the basic functionality.