Implement most of chmod
Merge pull request #428 from Arcterus/chmod

Implement most of chmod