add functions for each piece, and update Makefile