compacting some code. In progress.