Adds log in check, cleans up.