changed permissions and completed implementation for k=2