Fixed compilation errors and introduced a function to create lists