split class and algorithm into separate files.