adding some testing for andys, cleaning up code