Sample working example and code clean-up