Code cleanup + example