Added chmod funtionality.