fixed key/cert paths, added debugging, code cleanup