init and setup environment