Added comments and finished allow/deny permission funtions