progress, but still some bugs to fix