refactoring + makefile for test ver.