cleanup of code, to-do: extend calcbasestate() to 4th order scheme