Merged init and setup functions.