More testing added and slight code cleanup