Structure changes, new permission algo

Added new (non RegEx) permission checking algo
Major changes to application structure
Several small changes