slightly more testing/debugging. basically working