working but needs refactoring
Clean up