changed a little bit the class structure