refactored, ws closing still broken.