maint: update copyright year, add GPL
refactor: extract common functions into modules
build: fix minor errors