updated sample code, restructured tests