Main logic

Now it's working.
"handler" ;-)