not really working but good reference
working but needs clean up