Redo all code with more complex and stable setup