permission system in template… needs cleanup