Complete restructuring and adjustments

Up to 1.0.2 version.