Simplifying the script & Bugfixes