code cleanup. started on issue #6