Finished second part. Minor fixs