Very fisrt version (a lot of improvements are needed I think)