Removed freezing of application, and added an ajaxprefilter for adding login and api_key if attached to application