Moved most functions to before install.