Implemented Config and added permission checks

Formatting changes included