incorporate your changes plus proper Makefile and my implementation of your suggestion

Please review.