code complete, seems to be working