Debugging almost done
working now