polishing the whole file

adding enclosure, fixing bugs etc