got it working but not the right way