levels function and config function