edited to not use inline kernel