Change file mode bits
Code refactoring