splitted the code