Finished Main Functions