Finally add permissions implementation
Fix up a few issues