Included some error prevention by ensuring a logged in user and protecting against GETs returning nothing.