restructuring, and added a sample test