Add functional test
Split init function