restructure code, add bin, and initial tests