Fix require and remove unused code