Final Edit. The code is finished :)