a better approach with classes, not ready...
Rewritten it