Modernize, add tests