working but needs hard refactoring
clean up