Reorganize code and add simple triangle example.