More work

Found some bugs that need correcting as well