A new version with a more organized class structure