Added partitioning and some cosmetic changes