added test image and fixed bugs
added comments in code