working but hacky