Changing the guts to allow for shell and ajax calls.