Reconstructed as a class, for better configurability and reusability; also solving #3.