minor adjustments, cleaning up code