Added initial checks for required folders
Separated controls and started recode of javascript logic