changes to fix bc problem; doesnt work with periodic bcs; not well tested. trying someting different first