Finished the basic functionality