Improvements & refactoring

 * Directory autcreation for cache and settings
 * Internal refactoring