some minor changes, things need more tweaking til they work right