cleaning up code. Added tests and test images