Bug fixes, enhancemnets and file structures cleanup