use package listings
refactor code